using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace Norm
{
    public abstract class BaseObject
    {
        [Attribute.DatabaseField(Stored = true)]
        public Guid BaseObjectId;

        protected bool IsObjectInitialized = false;

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder(string.Format
                ("[{0}:", Helper.SqlHelper.TableName(this)));

            foreach (FieldInfo fi in Norm.Helper.SqlHelper.DatabaseFields(this))
                sb.Append(string.Format
                    ("({0}={1}) ",fi.Name,fi.GetValue(this)));

            return sb.ToString().Trim()+"]";
        }        
    }
}
